package com.ethan.minimalist.http

import com.ethan.minimalist.bean.Banner
import com.ethan.minimalist.bean.HttpResult
import com.ethan.minimalist.bean.UserBean
import io.reactivex.Observable
import retrofit2.http.*


interface LoginApi {

    @GET("banner/json")
    fun getHomeBanner(): Observable<HttpResult<MutableList<Banner>>>

    /**
     * 登录
     */
    @GET("member/login")
    fun login(
        @Query("account") username: String,
        @Query("password") password: String,
        @Query("loginDevice") loginDevice: String
    ): Observable<HttpResult<UserBean>>

    /**
     * 更新用户信息
     */
    @FormUrlEncoded
    @POST("member/updateInfo")
    fun updateInfo(
        @Field("sex") sex: String,
        @Field("birthday") birthday: String,
        @Field("nickName") nickName: String,
        @Field("height") height: String,
        @Field("weight") weight: String,
        @Field("avatar") avatar: String,
        @Field("balance") balance: String,
        @Field("yestodayMoney") yestodayMoney: String,
        @Field("coins") coins: String,
        @Field("setting") setting: String
    ): Observable<HttpResult<UserBean>>

    /**
     * 退出登录
     */
    @GET("user/logout/json")
    fun logout(): Observable<HttpResult<Any>>

    /**
     * 生成提现口令
     */
    @POST("member/createKitPwd")
    fun createKitPwd(): Observable<HttpResult<Any>>

    /**
     * 提现
     */
    @FormUrlEncoded
    @POST("member/kitMoney")
    fun kitMoney(
        @Field("pwd") pwd: String,
        @Field("kitMoney") kitMoney: String
    ): Observable<HttpResult<UserBean>>
}